package laspon.vvvlike.school.controller;

import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import laspon.vvvlike.school.dto.BaseResponse;
import laspon.vvvlike.school.dto.resquse.StudentAccountDto;
import laspon.vvvlike.school.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.HttpRequestHandler;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author by xqcw9 on 2020/9/11 14:41
 */

@RequestMapping("/StudentController")
@Api(tags = "用户后台管理相关接口")
@RestController
public class StudentController {

    private StudentService studentService;

    @Autowired
    public void setStudentService(StudentService studentService) {
        this.studentService = studentService;
    }

    @ResponseBody
    @PostMapping(value = "/studentAccount")
    @ApiOperation(value = "student表用户操作", notes = "student表用户操作")
    public BaseResponse studentAccount(HttpServletRequest request) {
        String phone = request.getParameter("tel");
        String wx = request.getParameter("VX");
        String name = request.getParameter("name");
        int flage = 1;
        StudentAccountDto stu = new StudentAccountDto(name, phone, wx, flage);
        return studentService.studentAccount(stu);
    }
}
